import { http } from "@/utils/http";
export type tmeplateItemType = Partial<{
  /*主键id */
  id: number;

  /*模版编码 */
  temCode: string;

  /*模版名称 */
  temName: string;

  /*厂区 */
  facCode: string;

  /*厂区描述 */
  facCodeDesc: string;

  /*科室 */
  className: string;

  /*科室描述 */
  classNameDesc: string;

  /*系统 */
  systemCode: string;

  /*系统描述 */
  systemCodeDesc: string;

  /*设备总称 */
  categoryId: number;

  /*设备总称描述 */
  categoryDesc: string;

  /*设备类型 */
  typeId: number;

  /*设备类型描述 */
  typeDesc: string;

  /*设备型号 */
  modelId: number;

  /*设备型号描述 */
  modelDesc: string;

  /*巡检内容类型 1 设备巡检 2 环境巡检 */
  inspectContentType: number;

  /*巡检内容类型描述 */
  inspectContentTypeDesc: string;

  /*巡检区域 */
  inspectTemplateAreaDTOList: {
    /*巡检模版区域id */
    id: number;

    /*巡检模版编码 */
    inspectTemCode: string;

    /*巡检模版区域 */
    inspectArea: string;

    /*巡检模版区域描述 */
    inspectAreaDesc: string;

    /*巡检模版区域全路径 */
    inspectAreaPath: string;
  }[];

  /*备注 */
  remark: string;

  /*更新人id */
  updateBy: number;

  /*巡检内容巡检项 */
  templateContentDTOList: {
    /*巡检项目内容id */
    inspectTaskTemContentId: number;

    /*巡检项目内容 */
    inspectItemContent: string;

    /*巡检项类型 1 抄表类 2 判断类 */
    inspectItemType: number;

    /*巡检项类型描述 */
    inspectItemTypeDesc: string;

    /*巡检项 */
    contentItemDTOList: {
      /*主键 */
      id: number;

      /*抄表项 */
      meterReadingItem: string;

      /*单位 */
      unit: string;

      /*最大值 */
      maxValue: string;

      /*最小值 */
      minValue: string;

      /*设备ID */
      eqpId: string;

      /*设备名字 */
      eqpName: string;

      /*自动抄表点 */
      autoMeterReadingPoint: string;

      /*巡检项 */
      inspectItem: string;

      /*巡检内容 */
      inspectContent: string;

      /*巡检内容范围(1-文本,2-数字,3-判断,4-选择) */
      inspectContentRangeCode: number;

      /*巡检内容范围描述 */
      inspectContentRangeCodeDesc: string;

      /*巡检内容范围 */
      inspectContentRangeValue: string;

      /*执行人id */
      executeBy: number;

      /*执行人名称 */
      executeByName: string;

      /*执行结果 */
      result: string;

      /*执行时间 */
      execTime: Record<string, unknown>;
    }[];
  }[];
}>;
export type tmeplateTabelType = Partial<{
  pageNum: number;
  pageSize: number;
  total: number;
  pages: number;
  data: [
    {
      id: number;
      temCode: number;
      temName: number;
      facCodeDesc: number;
      classNameDesc: number;
      systemCodeDesc: number;
      categoryDesc: number;
      typeDesc: number;
      modelDesc: number;
      inspectContentTypeDesc: number;
      updateBy: number;
      updateName: number;
      updateTime: number;
    }
  ];
}>;
export type queryPageType = Partial<{
  pageNum: number;
  pageSize: number;
  orderByColumn: string;
  isAsc: string;
  temCodeOrName: string;
  facCode: string;
  className: string;
  systemCode: string;
  inspectAreaList: string[];
  inspectContentTypes: number[];
  inspectTemCodeList: number[];
  isShowTemContent: boolean;
  orderBy: string;
}>;
export type addTmeplateType = {
  id: number;
  temCode: string;
  temName: string;
  facCode: string;
  className: string;
  systemCode: string;
  categoryId: number;
  typeId: number;
  modelId: number;
  inspectContentType: number;
  remark: string;
  meterReadingContentDTOList: [
    {
      inspectItemContent: string;
      sort: number;
      meterReadingContentItemDTOList: [
        {
          meterReadingItem: string;
          unit: string;
          maxValue: string;
          minValue: string;
          eqpId: string;
          autoMeterReadingPoint: string;
        }
      ];
    }
  ];
  judgeContentDTOList: [
    {
      inspectItemContent: string;
      sort: number;
      judgeContentItemDTOList: [
        {
          inspectItem: string;
          inspectContent: string;
          inspectContentRangeCode: 0;
          inspectContentRangeValue: string;
        }
      ];
    }
  ];
};
// 巡检模版-删除-禁用
export const delInspectTemplate = (id: string) => {
  return http.request("post", `/digitaltwins/api/v1/inspectTemplate/del/${id}`);
};
// 巡检模版-查询详情数据
export const getInspectTemplate = (id: any) => {
  return http.request<tmeplateItemType>("post", `/digitaltwins/api/v1/inspectTemplate/get/${id}`);
};
// 获取模版编码
export const getTemCode = () => {
  return http.request("post", `/digitaltwins/api/v1/inspectTemplate/getTemCode`);
};
// 巡检模版-查询分页列表接口
export const queryPage = (data: queryPageType) => {
  return http.request<tmeplateTabelType>("post", `/digitaltwins/api/v1/inspectTemplate/queryPage`, { data });
};
// 巡检模版-新增数据
export const saveInspectTemplate = (data: addTmeplateType) => {
  return http.request("post", `/digitaltwins/api/v1/inspectTemplate/save`, { data });
};
// 巡检模版-修改数据
export const updateInspectTemplate = (data: addTmeplateType) => {
  return http.request("post", `/digitaltwins/api/v1/inspectTemplate/update`, { data });
};
